package com.mvp.shq.washer.ui.shop.order.ordersubmit;

import com.mvp.shq.washer.entity.result.BaseResult;
import com.mvp.shq.washer.entity.shop.AddressData;
import com.mvp.shq.washer.entity.shop.TotalOrderData;
import com.mvp.shq.washer.entity.shop.result.OrderDataResult;
import com.mvp.shq.washer.entity.shop.result.OrderResult;
import com.mvp.shq.washer.http.RxSchedulers;
import com.mvp.shq.washer.http.ShopApi;

import io.reactivex.Observable;

/**
 * Created by westing on 2017/10/11.
 */

public class Model implements OrderSumbitConstract.Model {

    @Override
    public Observable<BaseResult<AddressData>> getDefaultAddress(String token, String userId) {
        return ShopApi.getInstance().service
                .getDefAddress(token,userId)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<OrderDataResult>> createOrder(String token, TotalOrderData ecTotalOrderDto) {
        return ShopApi.getInstance().service
                .createOrder(token,ecTotalOrderDto)
                .compose(RxSchedulers.io_main());
    }
}
